package Collections;

import java.util.*;

/**
 * @Author wangzhipeng
 * @Date 2020-08-13 4:30 下午
 * @Description
 */
public class Demo {
    public static void main(String[] args) {

        List<Integer> list = new ArrayList<>();

        list.add(13);
        list.add(22);
        list.add(30);

        Collections.shuffle(list);//乱序
        System.out.println("随机打乱"+list);

        Collections.sort(list);
        System.out.println("排序"+list);

        Collections.sort(list, new Comparator<Integer>() {
            @Override
            public int compare(Integer o1, Integer o2) {
               if(o1%10 < o2%10)
                   return 1;
                return 0;
            }
        });
        System.out.println("自定义排序"+list);


        int max = Collections.max(list);
        System.out.println("最大值"+max);



    }
}
